import request from '@/config/axios'
import { OrderListParams } from './types'

// 获取团购订单的每个订单状态的订单个数
export const groupOrderCountApi = () => {
  return request.get({ url: '/order/getGroupOrderCount' })
}

// 团购订单列表
export const groupOrdertApi = (params: OrderListParams) => {
  return request.get({ url: '/order/pageGroupOrder', params })
}

// 团购详情
export const groupOrderDetailsApi = (orderId: number) => {
  return request.get({ url: '/order/detailOrder', params: { orderId } })
}

// 商户后台团购详情
export const adminGroupOrderDetailsApi = (orderId: number) => {
  return request.get({ url: '/admin/order/detailOrder', params: { orderId } })
}

// 获取报名订单的每个订单状态的订单个数
export const enrollOrderCountApi = () => {
  return request.get({ url: '/order/getEnrollOrderCount' })
}

// 导出团购订单
export const getExportGroupExcelApi = (params: OrderListParams) => {
  return request.get({ url: '/order/exportGroupExcel', params, responseType: 'blob' })
}

// 导出积分订单
export const getExportPointsExcelApi = (params: OrderListParams) => {
  return request.get({ url: '/order/exportPointsExcel', params, responseType: 'blob' })
}

// 商户后台导出积分订单
export const adminGetExportPointsExcelApi = (params: OrderListParams) => {
  return request.get({ url: '/admin/order/exportPointsExcel', params, responseType: 'blob' })
}

// 报名订单列表
export const enrollOrderApi = (params: OrderListParams) => {
  return request.get({ url: '/order/pageEnrollOrder', params })
}

// 报名详情
export const enrollOrderDetailsApi = (orderId: number) => {
  return request.get({ url: '/order/detailEnrollOrder', params: { orderId } })
}

// 导出报名订单
export const getExportEnrollExcelApi = (params: OrderListParams) => {
  return request.get({ url: '/order/exportEnrollExcel', params, responseType: 'blob' })
}

// 订单列表
export const pageOrderApi = (params) => {
  return request.get({ url: '/order/pageOrder', params })
}

// 商家后台订单审核
export const auditApi = (data) => {
  return request.post({ url: '/admin/order/audit', data })
}

// 商家后台订单批量审核
export const batchAuditApi = (data) => {
  return request.post({ url: '/admin/order/batchAudit', data })
}

// 积分订单列表
export const pagePointsOrderApi = (params) => {
  return request.get({ url: '/order/pagePointsOrder', params })
}

// 商家后台积分订单列表
export const adminPagePointsOrderApi = (params) => {
  return request.get({ url: '/admin/order/pagePointsOrder', params })
}

// 商家后台订单列表
export const adminPageOrderApi = (params) => {
  return request.get({ url: '/admin/order/pageOrder', params })
}

// 商家后台订单详情
export const adminOrderDetailsApi = (orderId) => {
  return request.get({ url: '/admin/order/detailOrder', params: { orderId } })
}

// 佣金订单列表
export const pageCommissionOrderApi = (params) => {
  return request.get({ url: '/order/pageCommissionOrder', params })
}

// 商家后台佣金订单列表
export const adminPageCommissionOrderApi = (params) => {
  return request.get({ url: '/admin/order/pageCommissionOrder', params })
}

// 导出佣金订单
export const exportCommissionExcelApi = (params) => {
  return request.get({ url: '/order/exportCommissionExcel', params, responseType: 'blob' })
}

// 商家后台导出佣金订单
export const adminExportCommissionExcelApi = (params) => {
  return request.get({ url: '/admin/order/exportCommissionExcel', params, responseType: 'blob' })
}
